# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-neelance-sourcemap
pkgver=0.0.20200213
_commit=2833bce08e4c77c3e07af9cc765b046ccb259671
pkgrel=1
pkgdesc="JavaScript source map reader & writer for Go"
arch=('any')
url="https://github.com/neelance/sourcemap"
license=('BSD')
depends=('go')
source=("$pkgname-$_commit.tar.gz::https://github.com/neelance/sourcemap/archive/$_commit.tar.gz")
sha512sums=('5e1664fe852c5e1ee35e9189e00cc992e69dafa7c7a1b1bf894e73c2fc509209a1789da3c062bfa60ce940655a1b3f5bb150ec4ad7a05c33a735039fcdd7259b')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/neelance
  cp -a "$srcdir"/sourcemap-$_commit "$srcdir"/build/src/github.com/neelance/sourcemap
  cd "$srcdir"/build/src/github.com/neelance/sourcemap
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/neelance
  cp -a "$srcdir"/sourcemap-$_commit "$pkgdir"/usr/share/gocode/src/github.com/neelance/sourcemap

  install -Dm644 sourcemap-$_commit/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
